<?php

require_once 'classes/LightPressPlugin.php';

class TemplateWords extends LightPressPlugin {
    
    var $constructor_args = array(
        'words'=>'list of words separated by a space');
    var $default_context = LP_CONTEXT_ALL;
    var $description = 'Exports a list of arbitrary words as template variables of the form plugin_tplword_n eg plugin_tplword_0, plugin_tplword_1 etc. Use it to export adsense codes, or other single words.';
    
    var $active = true;
    var $hooks = array('post_render');
    
    var $words = 'apple pear banana';
    
    function TemplateWords(&$frontend, $args, $dummy_run=false) {
        $this->LightPressPlugin($frontend, $args, $dummy_run);
    }
    
    function run($hook, &$payload) {
        $tpl =& $this->_frontend->tpl;
        $tplwords = array();
        foreach (explode(' ', $this->words) as $i=>$word)
            $tplwords["plugin_tplword_$i"] = $word;
        $tpl->setVar($tplwords);
    }
    
}

?>